package com.zb.vo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.zb.entity.ZjGoodsUnit;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.util.Date;

/**
 * @Author WEN
 * @Date 2023/8/1 0001
 **/
@Data
@ApiModel("商品单位列表对象")
public class GoodsUnitListVo {
    @ApiModelProperty(value = "单位ID")
    private Long id;

    @ApiModelProperty(value = "单位名称")
    private String name;

    @ApiModelProperty(value = "单位状态：false-启用，true-禁用")
    private Boolean status;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "更新时间")
    private Date updateTime;

    public static GoodsUnitListVo beanToVo(ZjGoodsUnit unit) {
        GoodsUnitListVo vo = new GoodsUnitListVo();
        BeanUtils.copyProperties(unit, vo);
        vo.setStatus(unit.getDisabled());
        vo.setCreateTime(unit.getGmtCreate());
        vo.setUpdateTime(unit.getGmtUpdate());
        return vo;
    }
}
